from rest_framework import serializers

from apps.aiauth.models import Users, Userconnection, Role
from apps.setup.serializers import UserInfoSerializer


class UserconnectionSerialize(serializers.ModelSerializer):
    class Meta:
        model = Userconnection
        fields = ('displayname', 'imageurl')


class RoleSerializer(serializers.ModelSerializer):
    class Meta:
        model = Role
        fields = ('role_id', 'rolename', 'description')


class UsersSerializer(serializers.ModelSerializer):
    userinfo = UserInfoSerializer()
    role = RoleSerializer()

    class Meta:
        model = Users
        fields = ('studentid', 'username', 'userinfo', 'role', 'email', 'qqid', 'wechatid', 'phonenumber')
